<?php
namespace app\common\model;

use think\Model;

class AdminUser extends Model
{

    /**
     * 根据用户名获取后端的用户数据
     * @param $username '用户名
     * @return array|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     * @author bjy
     */
    public function getInfoByUsername($username){
        $where=[
            "username"=>trim($username),
        ];
        $result = $this->where($where)->find();
        return $result;
    }

    /**
     * 根据主键ID更新 数据表内的数据
     * @param $id
     * @param $data
     * @return bool
     * @author bjy
     */
    public function updateById($id,$data){
        $where=[
            "id"=>intval($id),
        ];
        $result = $this->where($where)->save($data);
        return $result;
    }

}